function check( form )
{
	var inputElements = form.getElementsByTagName('input');

	for (var i = 0; i < inputElements.length; i++ )
	{
		var inputElement = inputElements[i];
		
		if ( inputElement.type != 'text' ) continue;
		
		if ( inputElement.getAttribute('title').lastIndexOf('positive integer') > 0 && !checkPositiveInteger(inputElement.value) )
		{
			alert( inputElement.getAttribute('title') );
			inputElement.focus();
			
			return false;
		}
		else if ( inputElement.getAttribute('title').lastIndexOf('positive float') > 0 && !checkPositiveFloat(inputElement.value) )
		{
			alert( inputElement.getAttribute('title') );
			inputElement.focus();
			
			return false;
		}
		else
		{
			// other checks.
		}
	}
	
	return true;
}

function checkPositiveInteger( inStr )
{
	return isNumeric( inStr, false, false ) && ( parseInt(inStr) >= 0 );
}

function checkPositiveFloat( inStr )
{
	return isNumeric( inStr, true, false ) && ( parseFloat(inStr) >= 0 );
}

function isNumeric( x, isFloat)
{
	var numbers = isFloat ? ".0123456789" : "0123456789";
	
    // is x a String or a character?
	if(x.length>1) {
	  // remove negative sign
	  x=Math.abs(x)+"";
	  for(j=0;j<x.length;j++) {
		// call isNumeric recursively for each character
		number=isNumeric( x.substring(j,j+1), isFloat );
		if(!number) return number;
	  }
	  
	  return number;
	}
	else {
	  // if x is number return true
	  if(numbers.indexOf(x)>=0) return true;
	  
	  return false;
	}
}